package com.wang.bootbuilder.service;

import com.wang.bootbuilder.entity.pojo.Product;
import com.wang.bootbuilder.mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;

@Component
public class TestTranMain {

    @Autowired
    ProductMapper productMapper;

    @Autowired
    TestTran test;

    @Transactional()
    public void splitTest() {
        // 添加商品
        Product insertProduct = new Product();
        insertProduct.setCategoryId(123456L);
        insertProduct.setPcategoryId(78945646L);
        insertProduct.setProductName("aaaaa");
        insertProduct.setProductDesc("bnknm");
        insertProduct.setPrice(new BigDecimal("100"));
        insertProduct.setStatus(0);
        productMapper.insert(insertProduct);
        test.splitTest12();
        try {
            int a = 1/0;
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
